<%@ page contentType="text/html; charset=utf-8" language="java" import="java.util.*" pageEncoding="utf-8" errorPage="" %>
<%@ page import="club325.webchat.servlet.admin.AdminManager" %>
<%@ page session="false" %>

<%
	List<String> ipList = null;
	List<String> userList = null;
	ipList = AdminManager.getAllPreventIP();
	userList = AdminManager.getUserbyPunish(1);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/frame.dwt.jsp" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Keywords" content="WebChat,Chat" />
<meta http-equiv="Description" content="Chatting on Web" />

<!-- InstanceBeginEditable name="doctitle" -->
<title>用户管理</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<link href="/WebChat/style/admin_management.css" rel="stylesheet" type="text/css" />
<script src="/WebChat/SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="/WebChat/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->

<link href="/WebChat/style/global.css" rel="stylesheet" type="text/css" />
<link href="/WebChat/style/frame.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="main">
<!-- InstanceBeginEditable name="EditRegion_main" -->
  <h1>用户管理...</h1>
  <h5>封禁ip :</h5>
  <form id="form_ip" name="form_ip" method="post" action="/WebChat/servlet/PreventVisitorServlet" class="form_delete">
  <table width="500" border="0" cellpadding="0" cellspacing="0" class="table_delete">
    <tr>
      <th width="90" scope="row">所封禁的ip :</th>
      <td width="410"><span id="spryIP">
        <input type="text" name="ip" class="box" id="ip" value="" />
        <span class="textfieldRequiredMsg">需要提供一个值</span><span class="textfieldInvalidFormatMsg">格式无效</span></span>
        <input type="submit" name="submit" class="button" id="submit" value="封禁" />
      </td>
    </tr>
  </table>
  </form>
  <div class="list">
    <table width="420" border="0" cellspacing="0" cellpadding="0" class="item_list">
      <tr>
        <th width="292" scope="col">ip地址</th>
        <th scope="col">操作</th>
      </tr>
      <%
    	if (ipList == null || ipList.isEmpty()) {
      %>
      <tr>
       	<td colspan="2">暂无信息</td>
      </tr>
      <%
    	} else {
    		for (String ip : ipList) {
      %>
      <tr>
        <td><%= ip %></td>
        <td width="126"><a href="/WebChat/servlet/AllowVisitorServlet?ip=<%= ip %>">解禁</a></td>
      </tr>
      <%
    		}
    	}
      %>
    </table>
  </div>
  <h5>封禁用户 :</h5>
  <form id="form_name" name="form_name" method="post" action="/WebChat/servlet/PunishUserServlet" class="form_delete">
  <table width="500" border="0" cellpadding="0" cellspacing="0" class="table_delete">
    <tr>
      <th width="110" scope="row">所封禁的用户名 :</th>
      <td width="390">
        <input type="text" name="name" class="box" id="name" value="" />
        <input type="submit" name="submit" class="button" id="submit" value="封禁" />
      </td>
    </tr>
  </table>
  </form>
  <div class="list">
    <table width="420" border="0" cellspacing="0" cellpadding="0" class="item_list">
      <tr>
        <th width="222" scope="col">用户名</th>
        <th colspan="2" scope="col">操作</th>
      </tr>
      <%
    	if (userList == null || userList.isEmpty()) {
      %>
      <tr>
       	<td colspan="3">暂无信息</td>
      </tr>
      <%
    	} else {
    		for (String name : userList) {
      %>
      <tr>
        <td><%= name %></td>
        <td width="98"><a href="/WebChat/servlet/AllowUserServlet?name=<%= name %>">解禁</a></td>
        <td width="98"><a href="/WebChat/servlet/DeleteUserServlet?name=<%= name %>">删除</a></td>
      </tr>
      <%
    		}
    	}
      %>
    </table>
  </div>
<script type="text/javascript">
<!--
	var spryIP = new Spry.Widget.ValidationTextField("spryIP", "ip", {validateOn:["change"]});
//-->
</script>
<!-- InstanceEndEditable -->
</div>
</body>
<!-- InstanceEnd --></html>
